package com.hbut.controller;

import com.hbut.pojo.User;
import com.hbut.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value={"/list.action"})
    public String queryUserList(Model model){
        List<User> list = userService.queryUserList();
        model.addAttribute("userList",list);
        return "user_list";
    }
    @RequestMapping("/add.action")
    public String userAdd(){
        return "user_add";
    }
}
